import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskCollaboratorVO, TaskCollaboratorForm, TaskCollaboratorQuery } from '@/api/task/taskCollaborator/types';

/**
 * 查询任务关联协调人列表
 * @param query
 * @returns {*}
 */

export const listTaskCollaborator = (query?: TaskCollaboratorQuery): AxiosPromise<TaskCollaboratorVO[]> => {
  return request({
    url: '/taskCollaborator/taskCollaborator/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务关联协调人详细
 * @param id
 */
export const getTaskCollaborator = (id: string | number): AxiosPromise<TaskCollaboratorVO> => {
  return request({
    url: '/taskCollaborator/taskCollaborator/' + id,
    method: 'get'
  });
};

/**
 * 新增任务关联协调人
 * @param data
 */
export const addTaskCollaborator = (data: TaskCollaboratorForm) => {
  return request({
    url: '/taskCollaborator/taskCollaborator',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务关联协调人
 * @param data
 */
export const updateTaskCollaborator = (data: TaskCollaboratorForm) => {
  return request({
    url: '/taskCollaborator/taskCollaborator',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务关联协调人
 * @param id
 */
export const delTaskCollaborator = (id: string | number | Array<string | number>) => {
  return request({
    url: '/taskCollaborator/taskCollaborator/' + id,
    method: 'delete'
  });
};
